<!--
 * @Author: 吴竹叶 2107206923@qq.com
 * @Date: 2023-09-27 15:22:32
 * @LastEditors: 吴竹叶 2107206923@qq.com
 * @LastEditTime: 2023-10-12 19:02:28
 * @FilePath: \BZ_JT_AnQuanHuanBaoGuanLiApp\src\views\staging\commom\AccidentEvents\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="common-details">
    <customDetailsTopbar :title="title" flag @back="back" />
    <div id="customScroolBox" class="d-scroll listInner px-1">
      <component :is="currentComponent" :company-id="companyId" />
    </div>
  </div>
</template>
<script>
import SafetyComponent from './components/safety/list.vue'
import environmentComponent from './components/environment/list.vue'
import fireFightingComponent from './components/fireFighting/list.vue'
import energySourcesComponent from './components/energySources/list.vue'
import CustomDetailsTopbar from '@/components/globals/custom-details-topbar.vue'
import commonList from '@/assets/mixin/commonList'
export default {
  components: {
    CustomDetailsTopbar,
    SafetyComponent,
    environmentComponent,
    fireFightingComponent,
    energySourcesComponent
  },
  mixins: [commonList],
  data() {
    return {
      currentComponent: '',
      title: '预警报警管理',
      list: [
        {
          key: '安全生产',
          value: 'SafetyComponent'
        },
        {
          key: '环保管理',
          value: 'environmentComponent'
        },
        {
          key: '消防管理',
          value: 'fireFightingComponent'
        },
        {
          key: '能源管理',
          value: 'energySourcesComponent'
        }
      ],
      companyId: '',
      current: ''
    }
  },
  created() {
    const { current, companyId } = this.$route.query
    this.companyId = companyId || ''
    this.current = current || ''
  },
  mounted() {
    this.list = this.list.find((v) => {
      return v.key.indexOf(this.current) > -1
    })
    this.currentComponent = this.list.value
  },
  methods: {
    // 返回工作台
    back() {
      this.$router.push({
        path: '/staging/monitor',
        query: { current: this.current }
      })
    }
  }
}
</script>
